package org.bootlimn.common;

/**
 * @author satsiv
 * This class defines the structure of a read write element as outputted by readwriteinfo 
 * and functions to access the individual attributes
 *
 */
public class Readwrite {

	private int rcount;				// number of reads so far
    private int wcount;				// number of writes so far
	private int time;				// timestamp
    private int pid;				// id of the process that requests the read/write
	private String execname;		// name of the process that requests the read/write
	private String pexecname;		// parent of the process
    private String type;			// current request being read or write
	private String file;			// which file
	

	//constructor

	public Readwrite(int rcount, int wcount, int time, int pid, String execname, String pexecname, String type, String file) {
		this.rcount = rcount;
        	this.wcount = wcount;
		this.time = time;
        	this.pid = pid;
		this.execname= execname;
		this.pexecname= pexecname;
        	this.type= type;
		this.file= file;		
	}

	//functions to access individual attributes of the class

        public int getRcount() {
		return rcount;
	}

        public void setRcount(int rcount) {
		this.rcount = rcount;
	}

	public int getWcount() {
		return wcount;
	}
        
        public void setWcount(int wcount) {
		this.wcount = wcount;
	}

	public int getTime() {
		return time;
	}

	public void setTime(int time) {
		this.time = time;
	}

	public int getPid() {
		return pid;
	}
       
        public void setPid(int pid) {
		this.pid = pid;
	}

	public String getExecname() {
		return execname;
	}

	public void setExecname(String execname) {
		this.execname = execname;
	}

	public String getPexecname() {
		return pexecname;
	}

	public void setPexecname(String pexecname) {
		this.pexecname = pexecname;
	}

        public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
		
	public String getFile() {
		return file;
	}

	public void setFile(String file) {
		this.file = file;
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("Read Write Details - ");
		sb.append("Rcount:" + getRcount());
		sb.append(", ");
		sb.append("Wcount:" + getWcount());
		sb.append(", ");
		sb.append("Time" + getTime());
		sb.append(", ");
		sb.append("Pid" + getPid());
		sb.append(", ");
		sb.append("Execname:" + getExecname());
		sb.append(", ");
		sb.append("Pexecname:" + getPexecname());
		sb.append(", ");
		sb.append("Type:" + getType());
		sb.append(",");
                sb.append("File:" + getFile());
		sb.append(".\n");
		
		return sb.toString();
	}

}
